/cmd/db.py docstring function __find_transcribers

main
Jean-Damien 3 years ago
parent a777d0762a
commit 8656160933

@ -107,16 +107,6 @@ def _create_doc(folder: str)-> None:
for data in tqdm(infos_doc, desc="Populating Document..."):
Document.create(**data)
def __find_transcribers(folder: str)-> None:
""""""
transcribers = []
for acte in sorted(os.listdir(folder)):
if acte.endswith(".xml"):
soup = make_soup(os.path.join(folder, acte))
transcriber = soup.fileDesc.titleStmt
for item in transcriber.find_all("respStmt"):
transcribers.append(item.find("name").text)
return set(transcribers)
def _create_agent(name_lst: list)-> None:
"""create table agent"""
@ -283,6 +273,26 @@ def _create_involved_in(folder: str):
for data in tqdm(princes_actes, desc="Populating involved_in..."):
Involved_in.create(**data)
def __find_transcribers(folder: str)-> None:
"""read all xml files in <folder>
and search for //teiHeader/fileDesc/titleStmt/respStmt/name
which contains name(s) of individual(s) respnsible(s)
for the act's trancription.
This function is used in init() function, all the names are
added to a list.
:param folder: name of a folder containing acts' xml file
:type folder: str
"""
transcribers = []
for acte in sorted(os.listdir(folder)):
if acte.endswith(".xml"):
soup = make_soup(os.path.join(folder, acte))
transcriber = soup.fileDesc.titleStmt
for item in transcriber.find_all("respStmt"):
transcribers.append(item.find("name").text)
return set(transcribers)
def __csv_indiv_infos(indiv_type):
"""extract individuals of the same type from static/csv/actors.csv
and make a list with them

Loading…
Cancel
Save