linguappt package¶
Subpackages¶
Submodules¶
linguappt.lib module¶
-
linguappt.lib.pdf2images(pdfpath, imgfolder='./', start=0, end=None)¶ Convert pdf into images
- Parameters
pdfpath (str) – pdf file path
imgfolder (str) – image folder. Default is current folder
start (int) – start page of pdf
end (int) – end page pdf
- Returns
number of images stored
- Return type
int
-
linguappt.lib.pptx2pdf(pptx, pdffolder='./')¶ Convert pptx into pdf
- Parameters
pptx (str) – pptx file
pdffile (str) – folder that the pdf is stored in
- Returns
pdf file path
- Return type
str
-
linguappt.lib.readCSV(filename)¶ Read csv file
- Parameters
filename (str) – csv file name
- Returns
records in csv file
- Return type
list of dict
-
linguappt.lib.read_json(jsonfile)¶
linguappt.phrase_ppt module¶
-
class
linguappt.phrase_ppt.PhrasePPT(sourcefile, title='', genre='classic')¶ Bases:
objectIt is designed as an abstract class to be inheritated for phrase ppt generation of different languages,
Note
DON’T use this class directly. To define a PhrasePPT for a lanugage
Define subclass inheriting
PhrasePPT, e.g,ChinesePhrasePPTDefine class variable
_templates, which is adict, key is template genre, value is template pathDefine class varibale
content_keys, which is alist, containing the heads in csv fileImplement method
_create_phrase(self)
-
convert_to_ppt(destfile='test.pptx')¶ Convert csv file containing vocabulary information into pptx file
- Parameters
destfile (str) – pptx file path
linguappt.structure_kg_ppt module¶
-
class
linguappt.structure_kg_ppt.StructureKGPPT(sourcefile, title='', genre='classic')¶ Bases:
objectIt is designed as an abstract class to be inheritated for phrase ppt generation of different languages,
Note
DON’T use this class directly. To define a StructureKGPPT for a lanugage
Define subclass inheriting
StructureKGPPT, e.g,ChineseStructureKGPPTDefine class variable
_templates, which is adict, key is template genre, value is template pathDefine class varibale
content_keys, which is alist, containing the heads in csv fileImplement method
_create_structure_kg(self)
-
convert_to_ppt(destfile='test.pptx')¶ Convert csv file containing vocabulary information into pptx file
- Parameters
destfile (str) – pptx file path
linguappt.vocab_ppt module¶
-
class
linguappt.vocab_ppt.VocabPPT(sourcefile, title='', genre='classic')¶ Bases:
objectIt is designed as an abstract class to be inheritated for vocabulary ppt generation of different languages,
Note
DON’T use this class directly. To define a VocabPPT for a lanugage
Define subclass inheriting
VocabPPT, e.g,ChineseVocabPPTDefine class variable
_templates, which is adict, key is template genre, value is template pathDefine class variable
content_keys, which is alist, containing the heads in csv fileImplement methods
_create_noun(self, v),_create_verb(self, v),_create_adj(self, v), wherevis a vocab object, corresponding to a record (one line) in csv file
-
convert_to_ppt(destfile='test.pptx')¶ Convert csv file containing vocabulary information into pptx file
- Parameters
destfile (str) – pptx file path
Module contents¶
linguappt Package
This module demostrates the usage of package linguappt.
Installation
$ pip3 install linguappt
Use as executable
$ lingua_vocabppt --sourcecsv [vocab csv file] --lang [language] --title [title shown in ppt] --destpptx [pptx file]
$ lingua_phraseppt --sourcecsv [phrase csv file] --lang [language] --title [title shown in ppt] --destpptx [pptx file]
$ lingua_pptx2pdf --sourcepptx [pptx file] --destdir [dest directory storing pdf and images]
Convert csv file containing vocabulary informatin into pptx file
from linguappt import SpanishVocabPPT, EnglishVocabPPT
def vocabppt(sourcecsv, title, lang, destpptx):
_PPTS = {
"en": EnglishVocabPPT,
"es": SpanishVocabPPT
}
_PPT = _PPTS[lang]
vp = _PPT(sourcecsv, title)
vp.convert_to_ppt(destpptx)
Convert csv file containing vocabulary informatin into pptx file
from linguappt import EnglishPhrasePPT, SpanishPhrasePPT
def phraseppt(sourcecsv, title, lang, destpptx):
_PPTS = {
"en": EnglishPhrasePPT,
"es": SpanishPhrasePPT
}
_PPT = _PPTS[lang]
vp = _PPT(sourcecsv, title)
vp.convert_to_ppt(destpptx)