API Reference¶
A list of the full API reference of all public classes and functions is below.
Public members can (and should) be imported from urdubiometer
, e.g.:
from urdubiometer import Scanner, GhazalScanner
Core Classes¶
-
class
urdubiometer.
Scanner
(transcription_parser, long_parser, short_parser, constraints, meters_list, find_feet=None, post_scan_filter=None)[source]¶ Scanner class.
- Parameters
transcription_parser (graphtransliterator.GraphTransliterator) – Transcription parser.
long_parser (graphtransliterator.GraphTransliterator) – Long metrical unit parser.
short_parser (graphtransliterator.GraphTransliterator) – Short metrical unit parser.
constraints (dict(str, dict(str, dict(str,list[str])))) – Nested dict of constraints, organized by previous node, next node, previous production and finally a list of next productions, e.g.
{'-':{'-': 's_bs':['s_c']}}
.meters_list (list[dict]) – A list of dictionaries of meters, containing a meter regex and details.
find_feet (function) – Method to add metrical feet to a scan
post_scan_filter (function) – Filter to be applied after scan, used to narrow results.
-
class
GhazalScanner
(meters_list=None, find_feet=None, meters_filter=None, with_mir=True)¶ Ghazal scanner for Urdu ghazal.
- Parameters
meters_list (: dict or None) –
with_mir (bool) – Allow Mir meters
meters_filter (
function
or None) – filter returning subsection of scanner’s meter list
-
GhazalScanner.
find_feet
(scan)¶ str: Finds feet based on a scan.
-
property
meters_list
¶ list
ofdict
:: Meters list.
-
scan
(input, first_only=False, graph_details=False, show_feet=False)[source]¶ Scan input.
- Parameters
input (str) – Input string
first_only (bool) – Return the first scan only
graph_details (bool) – Return the graph details (list of
NodeMatch
)show_feet (bool) – Show metrical feet in scan. Default is False.
- Returns
if graph_details is False, a list of UnitMatch. if graph_details is True, a list of NodeMatch. None if no complete scans are found.
- Return type
list or None
-
transcribe
(input)[source]¶ Transcribe input using transcription parser.
- Parameters
input (str) – Input string
- Returns
Transcription of input string
- Return type
str
-
property
translation_graph
¶ urdubiometer.DirectedGraph
:: Translation graph.