@@ -37,6 +37,14 @@ pub struct PyDhatuEntry {
3737 /// - `vidi~` --> `vind`
3838 pub ( crate ) clean_text : String ,
3939
40+ /// The Dhatupatha code for this dhatu.
41+ ///
42+ /// Examples:
43+ ///
44+ /// - `BU` --> `01.0001`
45+ /// - `eD` --> `01.0002`
46+ pub ( crate ) code : Option < String > ,
47+
4048 /// The meaning of this dhatu's *mūla* as an SLP1 string.
4149 ///
4250 /// We have meaning strings only for the ~2000 *mūla* dhatus from the Dhatupatha. Any roots
@@ -59,11 +67,12 @@ pub struct PyDhatuEntry {
5967impl PyDhatuEntry {
6068 /// Create a new `DhatuEntry`.
6169 #[ new]
62- #[ pyo3( signature = ( dhatu, clean_text, * , artha_sa = None , artha_en = None , artha_hi = None ,
70+ #[ pyo3( signature = ( dhatu, clean_text, * , code = None , artha_sa = None , artha_en = None , artha_hi = None ,
6371 karmatva = None , ittva = None , pada = None ) ) ]
6472 fn new (
6573 dhatu : PyDhatu ,
6674 clean_text : String ,
75+ code : Option < String > ,
6776 artha_sa : Option < String > ,
6877 artha_en : Option < String > ,
6978 artha_hi : Option < String > ,
@@ -74,6 +83,7 @@ impl PyDhatuEntry {
7483 Self {
7584 dhatu,
7685 clean_text,
86+ code,
7787 artha_sa,
7888 artha_en,
7989 artha_hi,
@@ -85,9 +95,10 @@ impl PyDhatuEntry {
8595
8696 fn __repr__ ( & self ) -> String {
8797 format ! (
88- "DhatuEntry(dhatu={}, clean_text={}, artha_sa={})" ,
98+ "DhatuEntry(dhatu={}, clean_text={}, code={}, artha_sa={})" ,
8999 self . dhatu. __repr__( ) ,
90100 py_repr_string( & self . clean_text) ,
101+ py_repr_option_string( & self . code) ,
91102 py_repr_option_string( & self . artha_sa) ,
92103 )
93104 }
@@ -103,6 +114,7 @@ impl<'a> From<&DhatuEntry<'a>> for PyDhatuEntry {
103114 Self {
104115 dhatu : val. dhatu ( ) . into ( ) ,
105116 clean_text : val. clean_text ( ) . to_string ( ) ,
117+ code : val. code ( ) . map ( |x| x. to_string ( ) ) ,
106118 artha_sa : val. artha_sa ( ) . map ( |x| x. to_string ( ) ) ,
107119 artha_en : val. artha_en ( ) . map ( |x| x. to_string ( ) ) ,
108120 artha_hi : val. artha_hi ( ) . map ( |x| x. to_string ( ) ) ,
0 commit comments