MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / Jargon

Class Jargon

service/jargon/jargon.py:21–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20
21class Jargon:
22
23 def __init__(self, rawdata: dict):
24 self._rawdata = rawdata
25
26 # copy the data to lowercase keys, ignore blank keys
27 self._data = {str(k).lower(): v for k, v in rawdata.items() if k}
28
29 def get(self, term: str) -> str:
30 return self._data.get(term.lower())
31
32 def get_rawdata(self) -> dict:
33 return self._rawdata
34
35 def apply(self, query_words):
36 parts = []
37 for word in query_words:
38 replacements = self.get(word)
39 if replacements:
40 parts.append('({})'.format('|'.join(replacements)))
41 else:
42 parts.append(word)
43 return parts

Callers 1

_load_jargonMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected