Lookup¶
DataSource¶
-
class
cardbuilder.lookup.data_source.DataSource[source]¶ Bases:
abc.ABCThe base class for all data sources, responsible for looking up various linguistic data about words. It implements basic logic for generating SQLite tables with the default schema (word TEXT, content) where the content type is defined by the class variable content_type.
-
class
cardbuilder.lookup.data_source.WebApiDataSource(enable_cache_retrieval=True)[source]¶ Bases:
cardbuilder.lookup.data_source.DataSource,abc.ABCThe base class for data sources which directly look up data somewhere online, either by calling an APi or scraping HTML.
-
class
cardbuilder.lookup.data_source.ExternalDataDataSource[source]¶ Bases:
cardbuilder.lookup.data_source.DataSource,abc.ABCThe base class for data sources which depend on external data such as downloaded files. Contains logic for ingesting these files into SQlite tables and looking up data from those tables.
-
class
cardbuilder.lookup.data_source.AggregatingDataSource[source]¶ Bases:
cardbuilder.lookup.data_source.DataSource,abc.ABCThe base class for data sources that own other data sources and don’t have a sqlite table of their own.
LookupData¶
Values¶
-
class
cardbuilder.lookup.value.SingleValue(val)[source]¶ Bases:
cardbuilder.lookup.value.ValueRepresents a single value, such as a part of speech, IPA for a word, or a word itself.
-
input_type¶ alias of
str
-
-
class
cardbuilder.lookup.value.MultiValue(list_header_tuples)[source]¶ Bases:
cardbuilder.lookup.value.ValueRepresents multiple values, each optionally paired with a header value. Useful for capturing pairs or mappings of values, such as words where pronunciation is different based on the part of speech. For straightforward lists of values, use ListValue
-
get_data()[source]¶ - Return type
List[Tuple[SingleValue,Optional[SingleValue]]]
-
-
class
cardbuilder.lookup.value.ListValue(value_list)[source]¶ Bases:
cardbuilder.lookup.value.ValueRepresents a list of values, such as multiple possible parts of speech or multiple definitions.
-
get_data()[source]¶ - Return type
List[SingleValue]
-
input_type¶ alias of List[str]
-
-
class
cardbuilder.lookup.value.MultiListValue(list_header_tuples)[source]¶ Bases:
cardbuilder.lookup.value.ValueRepresents multiple lists of values, each optionally paired with a header value. Most commonly used in cases where a word has multiple possible parts of speech, and there is a list of values (such as definitions) associated with each part of speech.
-
get_data()[source]¶ - Return type
List[Tuple[ListValue,Optional[SingleValue]]]
-
-
class
cardbuilder.lookup.value.LinksValue(link_data)[source]¶ Bases:
cardbuilder.lookup.value.ValueRepresents a link in a dictionary to another word. Useful only in very specific cases.