watex.utils.funcutils.smart_strobj_recognition#
- watex.utils.funcutils.smart_strobj_recognition(name, container, stripitems='_', deep=False)[source]#
Find the likelihood word in the whole containers and returns the value.
- Parameters
name – str - Value of to search. I can not match the exact word in
the container :param container: list, tuple, dict- container of the many string words. :param stripitems: str - ‘str’ items values to sanitize the content
element of the dummy containers. if different items are provided, they can be separated by
:,,and;. The items separators aforementioned can not be used as a component in the name. For isntance:name= 'dipole_'; stripitems='_' -> means remove the '_' under the ``dipole_`` name= '+dipole__'; stripitems ='+;__'-> means remove the '+' and '__' under the value `name`.
- Parameters
deep – bool - Kind of research. Go deeper by looping each items for find the initials that can fit the name. Note that, if given, the first occurence should be consider as the best name…
- Returns
Likelihood object from container or Nonetype if none object is detected.
- Example
>>> from watex.utils.funcutils import smart_strobj_recognition >>> from watex.methods import ResistivityProfiling >>> rObj = ResistivityProfiling(AB= 200, MN= 20,) >>> smart_strobj_recognition ('dip', robj.__dict__)) ... None >>> smart_strobj_recognition ('dipole_', robj.__dict__)) ... dipole >>> smart_strobj_recognition ('dip', robj.__dict__,deep=True ) ... dipole >>> smart_strobj_recognition ( '+_dipole___', robj.__dict__,deep=True , stripitems ='+;_') ... 'dipole'