Welcome to dcs_wrapper’s documentation!¶
A simple wrapper around the DCS database that supports iteration and tag conversion
-
class
dcs_wrapper.DCS(file_path=None)[source]¶ Simple wrapper around the DCS database supporting iteration
Parameters: file_path (str, None) – Use the data in directory file_path. file_path = None defaults to using data supplied with the package which will be extracted on first use Example: >>> from dcs_wrapper import DCS >>> with DCS() as dcs: >>> for book in dcs.iter_books(): >>> print(book.dcsId, book.title) >>> for chapter in dcs.iter_chapters(): >>> print(chapter.dcsId, chapter.dcsName) >>> for sentence in dcs.iter_sentences(): >>> print(sentence.dcsId, sentence.text)
-
iter_books()¶
-
iter_chapters()¶
-
iter_sentences()¶
-
-
class
dcs_wrapper.Book(dcsId, title, chapterIds)¶ -
chapterIds¶ List of IDs of chapters in the book
-
dcsId¶ ID of the book in DCS
-
title¶ Title of the book
-
-
class
dcs_wrapper.Chapter(dcsId, dcsName, sentenceIds)¶ -
dcsId¶ ID of the chapter in DCS
-
dcsName¶ Name of the chapter in DCS
-
sentenceIds¶ List of IDs of sentences in the book
-
-
class
dcs_wrapper.Sentence(dcsId, text, dcsAnalysisDecomposition)¶ -
dcsAnalysisDecomposition¶ Grammatical analysis of each word represented as list(list(
WordAnalysis))
-
dcsId¶ ID of the sentence in DCS
-
text¶ IAST encoded unicode string of the actual text
-
-
class
dcs_wrapper.WordAnalysis(dcsId, root, dcsGrammarHint)¶ -
dcsGrammarHint¶ Grammatical analysis of each word
-
dcsId¶ ID of the lemma in DCS
-
root¶ IAST encoded unicode lemma/root of the word
-
-
dcs_wrapper.from_json(s)[source]¶ Convert a json string into an object of DCS wrapper
Looks at the jsonClass type hint in the json string to determine the type of object to return
Parameters: s (str) – JSON string Returns: Book, Chapter or Sentence depending on the encoded object Return type: Book,Chapter,Sentence