CN113221506A - Lecture typesetting method and device, electronic equipment and storage medium - Google Patents
Lecture typesetting method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113221506A CN113221506A CN202110527443.6A CN202110527443A CN113221506A CN 113221506 A CN113221506 A CN 113221506A CN 202110527443 A CN202110527443 A CN 202110527443A CN 113221506 A CN113221506 A CN 113221506A
- Authority
- CN
- China
- Prior art keywords
- file
- typesetting
- latex
- standard
- lecture
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 62
- 239000004816 latex Substances 0.000 claims description 105
- 238000004458 analytical method Methods 0.000 claims description 22
- 239000000203 mixture Substances 0.000 claims description 18
- 238000006243 chemical reaction Methods 0.000 claims description 11
- 238000005192 partition Methods 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 10
- 238000012986 modification Methods 0.000 description 10
- 230000004048 modification Effects 0.000 description 10
- 230000008569 process Effects 0.000 description 8
- 238000012545 processing Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 230000008901 benefit Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 239000000463 material Substances 0.000 description 3
- 230000006870 function Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000009877 rendering Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008595 infiltration Effects 0.000 description 1
- 238000001764 infiltration Methods 0.000 description 1
- 238000010606 normalization Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 230000005477 standard model Effects 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/103—Formatting, i.e. changing of presentation of documents
- G06F40/109—Font handling; Temporal or kinetic typography
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Processing Or Creating Images (AREA)
- Document Processing Apparatus (AREA)
Abstract
The disclosure provides a lecture typesetting method, a lecture typesetting device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a lecture file in a first document format to be typeset; based on the standard content model, standardizing the semantic file to obtain a standard file; the standard content model is used for uniformly describing the content and the style of the rich text documents in different document formats; obtaining a target typesetting system file based on the standard file and the target typesetting system configuration information; and typesetting the target typesetting system file to generate a lecture file in a second document format after typesetting. The standard file generated based on the standard content model in the method can well give consideration to the lecture file and the typesetting system file, and ensures the compatibility between the target typesetting system file and the typesetting system generated by configuring the standard file based on the target typesetting system configuration information subsequently, thereby reducing the probability of losing and error of typesetting content and ensuring higher typesetting accuracy.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for setting lecture notes, an electronic device, and a storage medium.
Background
With the expansion and infiltration of internet technology to the field of education, online education platforms have emerged endlessly. In an online education scenario, a teacher uses online lectures to write learning courseware. The typesetting and printing process related to the online lecture can lead out the lecture as a Word file, and then lead the Word file into offline typesetting software for secondary editing, thereby obtaining an edited learning courseware.
However, because the format of the on-line handout is different from that of the Word file, the mistake in format is inevitable when the handout is exported as the Word file, and in addition, because the Word file and the typesetting software have the problem of incompatibility, the finally edited courseware has more loss and mistakes in content and style.
Disclosure of Invention
The embodiment of the disclosure at least provides a method and a device for lecture typesetting, electronic equipment and a storage medium.
In a first aspect, an embodiment of the present disclosure provides a method for typesetting a lecture, where the method includes:
acquiring a lecture file in a first document format to be typeset;
based on a standard content model, standardizing the lecture file to obtain a standard file; the standard content model is used for uniformly describing the content and the style of the rich text documents in different document formats;
obtaining a target typesetting system file based on the standard file and the target typesetting system configuration information;
and typesetting the target typesetting system file to generate a lecture file in a second document format after typesetting.
By adopting the lecture typesetting method, firstly, a lecture file to be typeset can be standardized based on a standard content model to obtain a standard file, and the standard content model is used for uniformly describing the content and the style of rich text files in different file formats, so that the standard file generated based on the standard content model can well give consideration to both the lecture file and the typesetting system file, the compatibility between the target typesetting system file and the typesetting system generated by configuring the standard file based on the target typesetting system configuration information subsequently is ensured, the probability of losing and errors of typesetting contents is reduced, and the typesetting accuracy is higher.
In a possible implementation manner, the normalizing the lecture file based on the standard content model to obtain a standard file includes:
analyzing the lecture file based on a predefined file analysis model to analyze first file data information matched with the file analysis model;
determining an analyzed file according to the analyzed first file data information and the file analysis model;
converting the analyzed file based on a predefined standard content model to obtain second file data information matched with the standard content model;
and obtaining the standard file based on the obtained second file data information and the standard content model.
In consideration of the problem that the readability of the data structure of the lecture file is poor, the file analysis model can be used for analyzing, and then the analyzed file obtained through analysis is converted based on the standard content model, so that second file data information matched with the standard content model can be obtained, the standard file is obtained, the conversion from the lecture file to the standard file is achieved, and the file analysis method is more practical.
In a possible implementation manner, the obtaining the target composition system file based on the standard file and the target composition system configuration information includes:
reading each paragraph of the standard file in sequence; each of the paragraphs includes at least one partition;
for each read block in each paragraph, performing attribute analysis on the block based on a preset attribute analyzer, and determining the attribute of the block;
determining a LaTeX command matched with the attribute of each block based on the preset corresponding relation between each attribute and each LaTeX command;
and obtaining a LaTeX file based on the LaTeX command matched with the attribute of each block.
In view of the superior characteristics of the LaTeX file at the layout level, the target layout system file herein may include a LaTeX file. Here, the attribute of the chunk may be determined based on the result of attribute analysis on each chunk in each paragraph of the standard file, and then the LaTeX command matching the attribute of each chunk may be determined based on a preset correspondence between the attribute and the LaTeX command. In addition, the corresponding LaTeX commands are matched according to the attributes of the blocks, so that the unified modification of the attributes can be realized according to the modification of the LaTeX commands, and the subsequent typesetting efficiency is improved.
In a possible embodiment, the obtaining a LaTeX file based on the LaTeX commands matched with the attributes of each chunk includes:
for each block in each paragraph, binding the LaTeX command matched with the attribute of the block and the content of the block to obtain a LaTeX command line corresponding to the block;
for each paragraph, combining the LaTeX command lines corresponding to the blocks belonging to the paragraph to obtain the LaTeX command line corresponding to the paragraph;
and combining the LaTeX command lines corresponding to the paragraphs according to the arrangement sequence of the paragraphs to obtain a LaTeX file.
Here, the attributes of the blocks and the contents of the blocks are bound to obtain a LaTeX command line corresponding to each paragraph, and a final LaTeX file can be obtained through paragraph combination. For the LaTeX file, the properties of the blocks can be independently modified, the contents of the blocks can be independently modified, and the efficiency of subsequent typesetting is improved.
In a possible implementation manner, the step of composing the target layout system file to generate a composed lecture file in the second document format includes:
modifying the LaTeX file based on an editing instruction under the condition that the editing instruction of a client for the LaTeX file is determined to be received, so as to obtain a modified LaTeX file;
and typesetting the modified LaTeX file to generate a typeset PDF file.
In one possible embodiment, the LaTeX command comprises a macro command; receiving an editing instruction of a client for the LaTeX file, wherein the editing instruction comprises the following steps:
receiving a style editing instruction of a macro command for attribute matching of any block included in the LaTeX file;
alternatively, a content editing instruction for any partition included in the LaTeX file is received.
Here, the style editing may be implemented by a style editing instruction of a macro command that matches the properties of the blocks, or the content editing may be implemented by a content editing instruction of the blocks, which supports various editing requirements.
In a possible implementation manner, the typesetting the target typesetting system file to generate the lecture file in the second document format after typesetting includes:
and typesetting the target typesetting system file by calling a preset typesetting engine to generate a lecture file in a second document format after typesetting.
In a possible implementation manner, after obtaining the standard file for describing each file format, the method further includes:
and under the condition that a conversion instruction pointing to other target typesetting system files from the target typesetting system files is determined to be received, acquiring standard files corresponding to the target typesetting system files, and acquiring other typesetting system files based on the standard files and other typesetting system configuration information.
In consideration of that the standard file can take various different document formats into account, the target typesetting system file and other typesetting system files can be arbitrarily converted based on the standard file, and the adaptability is better.
In a second aspect, an embodiment of the present disclosure further provides an apparatus for setting handout, where the apparatus includes:
the obtaining module is used for obtaining a lecture file in a first document format to be typeset;
the first generation module is used for standardizing the handout file based on a standard content model to obtain a standard file; the standard content model is used for uniformly describing the content and the style of the rich text documents in different document formats;
the second generation module is used for obtaining a target typesetting system file based on the standard file and the target typesetting system configuration information;
and the typesetting module is used for typesetting the target typesetting system file to generate a lecture file in a second document format after typesetting.
In a third aspect, an embodiment of the present disclosure further provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, the processor and the memory communicate via the bus when the electronic device is operating, and the machine-readable instructions, when executed by the processor, perform the steps of the method of claim composition as set forth in any one of the first aspect and the various embodiments thereof.
In a fourth aspect, the disclosed embodiments also provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps of the method for setting lectures according to the first aspect and any one of the various embodiments.
For the description of the effects of the above-mentioned lecture composition apparatus, electronic device, and computer-readable storage medium, reference is made to the description of the above-mentioned lecture composition method, which is not repeated herein.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
FIG. 1 is a flow chart illustrating a method for typesetting a lecture provided by an embodiment of the present disclosure;
FIG. 2 is a schematic diagram illustrating an application of a method for typesetting a lecture provided by an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating an apparatus for composing a handout according to an embodiment of the disclosure;
fig. 4 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure, presented in the figures, is not intended to limit the scope of the claimed disclosure, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The term "and/or" herein merely describes an associative relationship, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Research shows that because of the difference in format between the online handout and the Word file, format errors can be avoided when the handout is exported as a Word file, and in addition, because of the incompatibility problem between the Word file and the typesetting software, the finally edited courseware has more loss and errors in content and style.
Based on the research, the disclosure provides a lecture typesetting method and device, electronic equipment and a storage medium, and the typesetting accuracy is high.
To facilitate understanding of the present embodiment, a method for typesetting a lecture disclosed in the embodiments of the present disclosure is first described in detail, and an execution subject of the method for typesetting a lecture provided in the embodiments of the present disclosure is generally a computer device with certain computing power, where the computer device includes: a terminal device, which may be a User Equipment (UE), a mobile device, a User terminal, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, or a server or other processing device. In some possible implementations, the method of handout composition may be implemented by a processor calling computer readable instructions stored in a memory.
Referring to fig. 1, a flowchart of a method for setting lectures provided in the embodiment of the present disclosure is shown, where the method includes steps S101 to S104, where:
s101: acquiring a lecture file in a first document format to be typeset;
s102: based on the standard content model, standardizing the semantic file to obtain a standard file; the standard content model is used for uniformly describing the content and the style of the rich text documents in different document formats;
s103: obtaining a target typesetting system file based on the standard file and the target typesetting system configuration information;
s103: and typesetting the target typesetting system file to generate a lecture file in a second document format after typesetting.
In order to facilitate understanding of the method for composing handout provided by the embodiment of the present disclosure, first, a brief description is given to an application scenario of the method. The lecture typesetting method can be mainly applied to online education scenes, and can help teaching teachers typeset lecture files to be typeset into typeset high-printing-quality lecture files so that teaching teachers can give lessons conveniently. Here, the lecture file to be laid out may be a lecture file edited using an on-line lecture editing tool, and have a special data structure. The high-printing-quality lecture file can be a rendered PDF file, and the visualization effect is better.
The format of the lecture file to be typeset can be a first document format which is described by using an EasySync OT data structure of a collaborative protocol and is related to the content and the style of rich text, and the readability of the EasySync OT data structure is poor.
In order to better realize the typesetting of the lecture file, the lecture file with the first document format can be standardized to obtain a standard file, and the standard file not only can well describe the conversion relationship between the lecture file and other various files, but also can solve the problem of poor readability. Thus, after the standard file is configured by using the target typesetting system configuration information, the target typesetting system file can be obtained.
The target typesetting system file may be a file with a better typesetting performance, for example, a LaTeX file, so that after the target typesetting system file is typeset, a lecture file in the second document format after typesetting can be obtained. For example, in the case of a LaTeX file as the target layout system file, the lecture file of the second document format after layout here may be a PDF file. In a specific application, the final typesetting effect can be realized through a rendering technology, which is not described herein.
In the embodiment of the disclosure, the standardized processing for the lecture file can be realized based on the standard content model, and the standard content model is used for uniformly describing the content and the style of the rich text document in different document formats, that is, can be used as an intermediate model for converting the document formats, so that the universality and the expansibility of the content conversion service can be ensured, and the mutual conversion among the document formats can be realized.
The standard content model can be a standard model extracted from each document format, and can take into account each document format, so that the target typesetting system file can be conveniently and quickly obtained by utilizing the configuration information of the target typesetting system. It can be known that for the lecture file with the first document format with poor readability, the standardization processing under the constraint of high readability can be carried out, and then the typesetting operation aiming at the target typesetting system file with good typesetting characteristics can be realized, so that the obtained lecture file with the second document format greatly reduces the probability of losing and wrong typesetting contents, and the typesetting accuracy is higher.
The target typesetting system configuration information in the embodiment of the disclosure may be a related configuration command for the target typesetting system file. In a specific application, the corresponding configuration command may be selected based on different target typesetting system files. In consideration of the excellent characteristics of the LaTeX file in the layout level, the LaTeX file may be used as the target layout system file.
For the LaTeX file, a preset typesetting engine can be called to realize typesetting in the embodiment of the disclosure. In a specific application, the XeTeX typesetting engine can be used for compiling and rendering so as to support OpenType font technology and generate a PDF file.
The XeTex typesetting engine can be contained in a TeX Live software publishing suit, and publishing images in the TeX Live software publishing suit can be packaged in a service image. Therefore, the LaTeX file can be compiled into the PDF file by directly calling the XeTeX typesetting engine, and the PDF file is rendered on the client side to be displayed.
Considering the key role of the standard document generation for the subsequent typesetting, the following process for generating the standard document can be explained, which specifically includes the following steps:
analyzing a semantic file based on a predefined file analysis model to analyze first file data information matched with the file analysis model;
secondly, determining an analyzed file according to the analyzed first file data information and a file analysis model;
converting the analyzed file based on a predefined standard content model to obtain second file data information matched with the standard content model;
and step four, obtaining a standard file based on the obtained second file data information and the standard content model.
Here, considering that the readability of the lecture file with the first document format is poor, the lecture file may be first parsed by using a predefined file parsing model to parse the first file data information matching with the file parsing model, where the parsing may be parsing of the collaborative data structure EasySync OT of the lecture file to be typeset.
The file parsing model can be used to describe the contents and attributes of each block in a file paragraph and a paragraph, and can be understood as a framework model. Taking online education as an example, the first file data information analyzed here may be contents related to blocks, including special service metadata such as test questions and subject plug-ins owned by the online lecture, or attributes related to blocks, including data such as styles of test questions.
It should be noted that, for different educational disciplines, the specific pointing content of the corresponding document paragraph may be different. For example, in a mathematical subject, a document paragraph herein may point to a mathematical subject, which may include a subject, a subject stem, and the like, where the subject and the subject stem may respectively correspond to a block and have respective attributes, for example, the subject is a style of font four, and the subject stem is a style of picture; for another example, in a Chinese subject, a document paragraph herein may correspond to a paragraph of an article.
Here, the first file data series information is input to the file analysis model, so that the analyzed file can be determined. For the parsed file, embodiments of the present disclosure may convert the parsed file based on a standard content model. The standard content model is also understood to be a framework model describing a common document format. Similarly, here, the second file data information obtained by converting the parsed file may be input to the standard content model, so that the standard file may be determined.
The lecture typesetting method provided by the embodiment of the disclosure can generate a target typesetting system file based on the standard file. Under the condition that the LaTeX file is used as a target typesetting system file, the LaTeX file can be obtained according to the following steps:
reading each paragraph of a standard file in sequence; each paragraph includes at least one partition;
secondly, performing attribute analysis on each block in each read paragraph based on a preset attribute analyzer to determine the attribute of the block;
determining a LaTeX command matched with the attribute of each block based on the preset corresponding relation between each attribute and each LaTeX command;
and step four, obtaining a LaTeX file based on the LaTeX command matched with the attribute of each block.
In order to better implement batch modification based on attributes, the embodiments of the present disclosure provide a scheme for separately configuring the attributes and contents of the partitions with commands.
Here, the attribute analysis of each block may be implemented based on an attribute analyzer, and then the LaTeX command matching the attribute of the block is determined, and then the final LaTeX file is determined according to the inclusion relationship between the blocks and the paragraphs and the arrangement order between the paragraphs. The method is realized by the following steps:
step one, aiming at each block in each paragraph, binding a LaTeX command matched with the attribute of the block and the content of the block to obtain a LaTeX command line corresponding to the block;
step two, aiming at each paragraph, combining the LaTeX command lines corresponding to the blocks belonging to the paragraph to obtain the LaTeX command line corresponding to the paragraph;
and step three, combining the LaTeX command lines corresponding to the paragraphs according to the arrangement sequence of the paragraphs to obtain a LaTeX file.
Considering that in the actual writing process, LaTeX may refer to a large number of macro packages and custom macro commands, and often needs to modify the style definition used to realize the setting of the style required for typesetting. Thus, the LaTeX command herein may be primarily a predefined macro command. That is, each attribute may point to a macro command, and after the corresponding macro command is determined, the content of the corresponding block may be bound to the macro command, so as to obtain a LaTeX command line corresponding to the block. Therefore, under the condition that the style is required to be modified subsequently, only the pre-definition of the macro command needs to be modified, and the time for typesetting and editing is greatly saved.
The composition operation in the disclosed embodiment may include a modification operation on the LaTeX file. Here, an editing window may be provided at the client, and when it is determined that an editing instruction for the LaTeX file is received by the client, the LaTeX file is modified based on the editing instruction to obtain a modified LaTeX file, and then the modified LaTeX file is typeset to generate a typeset PDF file.
The editing instruction may be determined by receiving a style editing instruction of a macro command for matching an attribute of any partition included in the LaTeX file, that is, by modifying the macro command at the client to select a style to be applied, or by receiving a content editing instruction for any partition included in the LaTeX file, that is, by modifying the content of the partition at the client to determine the modified content.
Any of the above editing instructions can be initiated by an online LaTeX editor set on the client, mainly for the typesetter to perform better editing operations.
In order to facilitate understanding of the above interaction process between the server and the client, the following can be further described with reference to fig. 2.
As shown in fig. 2, an editor interface is presented on the client. On the current editor interface, a user can initiate an editing instruction by using a LaTeX editor, so that relevant modification operation pointing to a specific LaTeX file can be carried out on the server side based on typesetting item management. The modification can be the modification of the content of the handout and the modification of the format of the handout.
Regardless of the modification manner, in the embodiment of the present disclosure, the LaTeX file may be compiled at the server, and the PDF file obtained by compiling may be rendered on an editor interface of the client.
The method for setting handout provided by the embodiment of the disclosure can also realize the conversion between different files by using the standard file so as to meet the file conversion requirements of users. Here, the method may include obtaining a standard file corresponding to the target layout system file when it is determined that a conversion instruction pointing to another target layout system file from the target layout system file is received, and obtaining another layout system file based on the standard file and the configuration information of the other layout system.
The other typesetting system files may be HTML files, Word files, or other system files, which is not limited in this disclosure.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, the embodiment of the present disclosure further provides a device for lecture material composition corresponding to the method for lecture material composition, and because the principle of solving the problem of the device in the embodiment of the present disclosure is similar to the method for lecture material composition described above in the embodiment of the present disclosure, the implementation of the device may refer to the implementation of the method, and repeated details are not described.
Referring to fig. 3, which is a schematic diagram of an apparatus for setting handout provided in an embodiment of the present disclosure, the apparatus includes: an acquisition module 301, a first generation module 302, a second generation module 303 and a typesetting module 304; wherein the content of the first and second substances,
an obtaining module 301, configured to obtain a lecture file in a first document format to be typeset;
a first generating module 302, configured to perform standardization processing on the semantic file based on the standard content model to obtain a standard file; the standard content model is used for uniformly describing the content and the style of the rich text documents in different document formats;
a second generating module 303, configured to obtain a target typesetting system file based on the standard file and the target typesetting system configuration information;
and the typesetting module 304 is used for typesetting the target typesetting system file to generate the lecture file in the second document format after typesetting.
The lecture typesetting device can firstly carry out standardized processing on a lecture file to be typeset based on a standard content model to obtain a standard file, and the standard content model is used for uniformly describing the content and the style of rich text documents in different document formats, so that the standard file generated based on the standard content model can well give consideration to both the lecture file and a typesetting system file, the compatibility between a target typesetting system file and a typesetting system generated by configuring the standard file based on target typesetting system configuration information subsequently is ensured, the probability of losing and errors of typesetting contents is reduced, and the typesetting accuracy is higher.
In a possible implementation, the first generating module 302 is configured to perform a normalization process on the semantic file based on the standard content model to obtain a standard file according to the following steps:
analyzing the semantic file based on a predefined file analysis model to analyze first file data information matched with the file analysis model;
determining an analyzed file according to the analyzed first file data information and the file analysis model;
converting the analyzed file based on a predefined standard content model to obtain second file data information matched with the standard content model;
and obtaining a standard file based on the obtained second file data information and the standard content model.
In a possible implementation manner, the target composition system file includes a LaTeX file, and the second generating module 303 is configured to obtain the target composition system file based on the standard file and the target composition system configuration information according to the following steps:
reading each paragraph of the standard file in sequence; each paragraph includes at least one partition;
for each read block in each paragraph, performing attribute analysis on the block based on a preset attribute analyzer, and determining the attribute of the block;
determining a LaTeX command matched with the attribute of each block based on the preset corresponding relation between each attribute and each LaTeX command;
and obtaining a LaTeX file based on the LaTeX command matched with the attribute of each block.
In a possible implementation, the second generating module 303 is configured to obtain a LaTeX file based on a LaTeX command matching the attribute of each block according to the following steps:
for each block in each paragraph, binding the LaTeX command matched with the attribute of the block and the content of the block to obtain a LaTeX command line corresponding to the block;
for each paragraph, combining the LaTeX command lines corresponding to the blocks belonging to the paragraph to obtain the LaTeX command line corresponding to the paragraph;
and combining the LaTeX command lines corresponding to the paragraphs according to the arrangement sequence of the paragraphs to obtain a LaTeX file.
In a possible implementation manner, the lecture file in the second document format includes a PDF file, and the layout module 304 is configured to perform layout on the target layout system file according to the following steps to generate a layout lecture file in the second document format:
modifying the LaTeX file based on the editing instruction under the condition that the editing instruction of the client for the LaTeX file is determined to be received, so as to obtain the modified LaTeX file;
and typesetting the modified LaTeX file to generate a typeset PDF file.
In one possible embodiment, the LaTeX commands include macrocommands; the typesetting module 304 is used for receiving an editing instruction of the client for the LaTeX file according to the following steps:
receiving a style editing instruction of a macro command for attribute matching of any block included in the LaTeX file;
alternatively, a content editing instruction for any partition included in the LaTeX file is received.
In one possible implementation, the typesetting module 304 is configured to typeset the target typesetting system file to generate a lecture file in the second document format after typesetting according to the following steps:
and typesetting the target typesetting system file by calling a preset typesetting engine to generate a lecture file in a second document format after typesetting.
In a possible embodiment, the above apparatus further comprises:
the conversion module 305 is configured to, after obtaining the standard file for describing each file format, obtain the standard file corresponding to the target typesetting system file when determining that a conversion instruction pointing to another target typesetting system file from the target typesetting system file is received, and obtain another typesetting system file based on the standard file and other typesetting system configuration information.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
An embodiment of the present disclosure further provides an electronic device, as shown in fig. 4, which is a schematic structural diagram of the electronic device provided in the embodiment of the present disclosure, and the electronic device includes: a processor 401, a memory 402, and a bus 403. The memory 402 stores machine-readable instructions executable by the processor 401 (for example, execution instructions corresponding to the obtaining module 301, the first generating module 302, the second generating module 303, and the composition module 304 in the apparatus in fig. 3, and the like), when the electronic device is operated, the processor 401 communicates with the memory 402 through the bus 403, and when the processor 401 executes the following processes:
acquiring a lecture file in a first document format to be typeset;
based on the standard content model, standardizing the semantic file to obtain a standard file; the standard content model is used for uniformly describing the content and the style of the rich text documents in different document formats;
obtaining a target typesetting system file based on the standard file and the target typesetting system configuration information;
and typesetting the target typesetting system file to generate a lecture file in a second document format after typesetting.
The embodiments of the present disclosure further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for composing lectures in the above method embodiments are executed. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, where instructions included in the program code may be used to execute steps of the method for lecture composition described in the above method embodiments, which may be referred to specifically in the above method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.
Claims (11)
1. A method for composing a handout, the method comprising:
acquiring a lecture file in a first document format to be typeset;
based on a standard content model, standardizing the lecture file to obtain a standard file; the standard content model is used for uniformly describing the content and the style of the rich text documents in different document formats;
obtaining a target typesetting system file based on the standard file and the target typesetting system configuration information;
and typesetting the target typesetting system file to generate a lecture file in a second document format after typesetting.
2. The method of claim 1, wherein the normalizing the lecture file based on the standard content model to obtain a standard file comprises:
analyzing the lecture file based on a predefined file analysis model to analyze first file data information matched with the file analysis model;
determining an analyzed file according to the analyzed first file data information and the file analysis model;
converting the analyzed file based on a predefined standard content model to obtain second file data information matched with the standard content model;
and obtaining the standard file based on the obtained second file data information and the standard content model.
3. The method according to claim 1 or 2, wherein the target composition system file comprises a LaTeX file, and the obtaining of the target composition system file based on the standard file and the target composition system configuration information comprises:
reading each paragraph of the standard file in sequence; each of the paragraphs includes at least one partition;
for each read block in each paragraph, performing attribute analysis on the block based on a preset attribute analyzer, and determining the attribute of the block;
determining a LaTeX command matched with the attribute of each block based on the preset corresponding relation between each attribute and each LaTeX command;
and obtaining a LaTeX file based on the LaTeX command matched with the attribute of each block.
4. The method of claim 3, wherein obtaining a LaTeX file based on the LaTeX commands matching the properties of each tile comprises:
for each block in each paragraph, binding the LaTeX command matched with the attribute of the block and the content of the block to obtain a LaTeX command line corresponding to the block;
for each paragraph, combining the LaTeX command lines corresponding to the blocks belonging to the paragraph to obtain the LaTeX command line corresponding to the paragraph;
and combining the LaTeX command lines corresponding to the paragraphs according to the arrangement sequence of the paragraphs to obtain a LaTeX file.
5. The method of claim 4, wherein the lecture file in the second document format comprises a PDF file, and wherein typesetting the target typesetting system file to generate the lecture file in the second document format after typesetting comprises:
modifying the LaTeX file based on an editing instruction under the condition that the editing instruction of a client for the LaTeX file is determined to be received, so as to obtain a modified LaTeX file;
and typesetting the modified LaTeX file to generate a typeset PDF file.
6. The method of claim 5, wherein the LaTeX commands comprise macro commands; receiving an editing instruction of a client for the LaTeX file, wherein the editing instruction comprises the following steps:
receiving a style editing instruction of a macro command for attribute matching of any block included in the LaTeX file;
alternatively, a content editing instruction for any partition included in the LaTeX file is received.
7. The method according to any one of claims 1 to 6, wherein the typesetting the target typesetting system file to generate the lecture file in the typeset second document format comprises:
and typesetting the target typesetting system file by calling a preset typesetting engine to generate a lecture file in a second document format after typesetting.
8. The method according to any one of claims 1 to 7, wherein after obtaining the standard file for describing each file format, the method further comprises:
and under the condition that a conversion instruction pointing to other target typesetting system files from the target typesetting system files is determined to be received, acquiring standard files corresponding to the target typesetting system files, and acquiring other typesetting system files based on the standard files and other typesetting system configuration information.
9. An apparatus for composing lecture, the apparatus comprising:
the obtaining module is used for obtaining a lecture file in a first document format to be typeset;
the first generation module is used for standardizing the handout file based on a standard content model to obtain a standard file; the standard content model is used for uniformly describing the content and the style of the rich text documents in different document formats;
the second generation module is used for obtaining a target typesetting system file based on the standard file and the target typesetting system configuration information;
and the typesetting module is used for typesetting the target typesetting system file to generate a lecture file in a second document format after typesetting.
10. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is operating, the machine readable instructions when executed by the processor performing the steps of the method of claim 1 to 8.
11. A computer-readable storage medium, having stored thereon a computer program for performing, when being executed by a processor, the steps of the method for composing a handout according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110527443.6A CN113221506A (en) | 2021-05-14 | 2021-05-14 | Lecture typesetting method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110527443.6A CN113221506A (en) | 2021-05-14 | 2021-05-14 | Lecture typesetting method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113221506A true CN113221506A (en) | 2021-08-06 |
Family
ID=77091920
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110527443.6A Pending CN113221506A (en) | 2021-05-14 | 2021-05-14 | Lecture typesetting method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113221506A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113569532A (en) * | 2021-09-22 | 2021-10-29 | 北京仁和汇智信息技术有限公司 | HTML editing method and device, electronic equipment and computer readable storage medium |
CN117236282A (en) * | 2023-10-24 | 2023-12-15 | 雅昌文化(集团)有限公司 | Intelligent typesetting method, device, terminal and medium based on XML data |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101872340A (en) * | 2009-04-23 | 2010-10-27 | 北京大学 | Typesetting method and device based on format layout template |
CN109815450A (en) * | 2017-11-20 | 2019-05-28 | 北大方正集团有限公司 | The method and device of XML file conversion Word file |
CN110147534A (en) * | 2019-02-27 | 2019-08-20 | 中国地质大学(武汉) | A kind of method and system that LaTeX document is converted to Word document |
CN110532525A (en) * | 2019-07-18 | 2019-12-03 | 深圳点猫科技有限公司 | A kind of method and device automatically generating handout based on web technology |
CN112651217A (en) * | 2019-10-09 | 2021-04-13 | 珠海金山办公软件有限公司 | Processing method and processing device of thesis document, electronic equipment and storage medium |
-
2021
- 2021-05-14 CN CN202110527443.6A patent/CN113221506A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101872340A (en) * | 2009-04-23 | 2010-10-27 | 北京大学 | Typesetting method and device based on format layout template |
CN109815450A (en) * | 2017-11-20 | 2019-05-28 | 北大方正集团有限公司 | The method and device of XML file conversion Word file |
CN110147534A (en) * | 2019-02-27 | 2019-08-20 | 中国地质大学(武汉) | A kind of method and system that LaTeX document is converted to Word document |
CN110532525A (en) * | 2019-07-18 | 2019-12-03 | 深圳点猫科技有限公司 | A kind of method and device automatically generating handout based on web technology |
CN112651217A (en) * | 2019-10-09 | 2021-04-13 | 珠海金山办公软件有限公司 | Processing method and processing device of thesis document, electronic equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
李园园;黄松;惠战伟;张东;: "XML-TeX-PDF文档转换方法与实现", 指挥信息***与技术, vol. 6, no. 06, 31 December 2015 (2015-12-31), pages 39 - 43 * |
潘若瑛: ""多模板多格式论文综合校排***的研究和实现"", 《中国优秀硕士学位论文全文数据库(信息科技辑)》, 15 June 2015 (2015-06-15), pages 1 - 81 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113569532A (en) * | 2021-09-22 | 2021-10-29 | 北京仁和汇智信息技术有限公司 | HTML editing method and device, electronic equipment and computer readable storage medium |
CN117236282A (en) * | 2023-10-24 | 2023-12-15 | 雅昌文化(集团)有限公司 | Intelligent typesetting method, device, terminal and medium based on XML data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Marin et al. | Bayesian essentials with R | |
CN108595389B (en) | Method for converting Word document into txt plain text document | |
Van Atteveldt et al. | Computational analysis of communication | |
CN111512315A (en) | Block-wise extraction of document metadata | |
US9817887B2 (en) | Universal text representation with import/export support for various document formats | |
CN113221506A (en) | Lecture typesetting method and device, electronic equipment and storage medium | |
CN111309313A (en) | Method for quickly generating HTML (hypertext markup language) and storing form data | |
CN104199871A (en) | High-speed test question inputting method for intelligent teaching | |
CN113283228A (en) | Document generation method and device, electronic equipment and storage medium | |
CN106294480A (en) | A kind of file layout change-over method, device and examination question import system | |
CN112860845A (en) | Test question retrieval method and device, electronic equipment and storage medium | |
CN116521621A (en) | Data processing method and device, electronic equipment and storage medium | |
CN112733056A (en) | Document processing method, device, equipment and storage medium | |
CN110502735B (en) | Method and system for quickly manufacturing universal process file of electronic equipment | |
KR102126342B1 (en) | Electronic document braille translation system and a method therefor | |
CN112487334A (en) | Method, apparatus, computer device and medium for front end page language translation | |
US11410575B2 (en) | Interface and tools for accessible textbook generation | |
CN116110065A (en) | Method, device, computer equipment and storage medium for generating question card data | |
CN109284401A (en) | Courseware tag adding and courseware recommending methods, courseware tag adding and courseware recommending devices and storage media | |
Kruse et al. | Word Processing Software: The Rise of MS Word | |
CN113792734A (en) | Neural network training and image processing method, device, equipment and storage medium | |
CN112613279A (en) | File conversion method and device, computer device and readable storage medium | |
KR20130083002A (en) | Apparatus and method for managing digital learning contents based on xml | |
CN101067785B (en) | Inserting platform-based resource management method and system | |
CN117953109B (en) | Method, system, electronic device and storage medium for translating generated pictures |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |