danoan.word_def.plugins.modules.multilanguage_chatgpt module

class danoan.word_def.plugins.modules.multilanguage_chatgpt.Adapter(configuration: Configuration, language: str)[source]

Bases: object

Adapter class that communicates with the word-guru API.

Each method is divided in two subtasks: - _[method_name]_api: Returns the raw api response. - _[method_name]_handle: Manipulate the response to return in the desired format.

Dividing this way allows us to create tests with mock responses for the handle.

Parameters:
get_definition(word: str) Sequence[str][source]
Parameters:

word (str)

Return type:

Sequence[str]

get_pos_tag(word: str) Sequence[str][source]
Parameters:

word (str)

Return type:

Sequence[str]

get_synonym(word: str) Sequence[str][source]
Parameters:

word (str)

Return type:

Sequence[str]

get_usage_example(word: str) Sequence[str][source]
Parameters:

word (str)

Return type:

Sequence[str]

class danoan.word_def.plugins.modules.multilanguage_chatgpt.AdapterFactory[source]

Bases: object

get_adapter(configuration_stream: TextIO | None = None) PluginProtocol[source]
Parameters:

configuration_stream (TextIO | None)

Return type:

PluginProtocol

get_language() str[source]

Language which the plugin is configured to respond.

Multilanguage plugins should return an empty string. The word-def api is responsible to create specific language versions upon request. You can rely on this methos to return the appropriated language code.

Return type:

str

version() str[source]
Return type:

str

class danoan.word_def.plugins.modules.multilanguage_chatgpt.Configuration(openai_key: str)[source]

Bases: object

Parameters:

openai_key (str)

openai_key: str