Closed seanpearsonuk closed 5 months ago
@hpohekar Please could you reply with the documented search()
function signature that we all designed today? You could show it to the wider group for discussion tomorrow.
def search(
search_string: str,
language: Optional[str] = None,
wildcard: bool = False,
exact: bool = False,
match_case=True,
):
"""Search for a word through the Fluent's object hierarchy.
Parameters
----------
search_string: str
The word to search for. Semantic search is default.
language: str
The language for the semantic search. English is default for the semantic search.
'albanian':'als', 'arabic':'arb', 'bulgarian':'bul', 'chinese_simplified':'cmn', 'chinese_traditional':'qcn',
'danish':'dan', 'greek':'ell', 'english':'eng', 'persian':'fas', 'finnish':'fin', 'french':'fra',
'hebrew':'heb', 'croatian':'hrv', 'icelandic':'isl', 'italian':'ita', 'japanese':'jpn', 'catalan':'cat',
'basque':'eus', 'galicain':'glg', 'spanish':'spa', 'indonesian':'ind', 'malay':'zsm', 'dutch':'nld',
'polish':'pol', 'portuguese':'por', 'romanian':'ron', 'lithuanian':'lit', 'slovak':'slk', 'slovene':'slv',
'swedish':'swe', 'thai':'tha'
wildcard: bool
Whether to use wildcard pattern. If ``True`` will match wildcard pattern based on ``fnmatch`` module and
will turn off semantic matching.
exact: bool
Whether to get exact match. If ``True`` will match exact string and will turn off semantic matching.
match_case: bool
Whether to match case. If ``False`` will match case-insensitive case.
Examples
----------
>>> import ansys.fluent.core as pyfluent
>>> pyfluent.search("iterate")
>>> pyfluent.search("iter*", wildcard=True)
>>> pyfluent.search("*iter", wildcard=True)
>>> pyfluent.search('读', 'cmn') # search 'read' in Chinese
The most similar API objects are:
<solver_session>.file.read (Command)
<solver_session>.file.import_.read (Command)
<solver_session>.mesh.surface_mesh.read (Command)
<solver_session>.tui.display.display_states.read (Command)
<meshing_session>.tui.display.display_states.read (Command)
"""
@hpohekar Thanks.
wildcard=True
.@seanpearsonuk
The examples that use wildcards will require wildcard=True. - Yes
The doc seems truncated on the right. - No. We have arranged it in the way to show all supported languages.
Are those the languages supported by the underlying API you are using? - Yes.
@seanpearsonuk
The examples that use wildcards will require wildcard=True. - Yes
The doc seems truncated on the right. - No. We have arranged it in the way to show all supported languages.
Are those the languages supported by the underlying API you are using? - Yes.
Yes, it was rendering badly for me earlier, hence the truncation, but it is gone now. I mentioned the wildcard=True because this will be discussed via examples. I will update the examples.
Current capabilities:
How might this be made more powerful? In general, it could be more like a search engine search. We can incorporate:
For the first two listed items at least, we found that the sematch Python library looked very promising in terms of its documented capabilities. Unfortunately, it is discontinued since Python 2.
We should research the ecosystem for libraries to support the above objectives.