danoan.word_guru.core.api module
- danoan.word_guru.core.api.get_correction(openai_key: str, cache_path: Path | None, word: str, language_alpha3: str) str[source]
Get the corrected version of a text.
- Raises:
OpenAIEmptyResponseError – If openai return an empty response.
LanguageCodeNotRecognizedError – If language code is not recognized.
- Parameters:
openai_key (str)
cache_path (Path | None)
word (str)
language_alpha3 (str)
- Return type:
str
- danoan.word_guru.core.api.get_definition(openai_key: str, cache_path: Path | None, word: str, language_alpha3) str[source]
Get the definition of a word.
The response is a string containing the definition of the word.
- Raises:
OpenAIEmptyResponseError – If openai return an empty response.
LanguageCodeNotRecognizedError – If language code is not recognized.
- Parameters:
openai_key (str)
cache_path (Path | None)
word (str)
- Return type:
str
- danoan.word_guru.core.api.get_pos_tag(openai_key: str, cache_path: Path | None, word: str, language_alpha3: str) str[source]
Get the part-of-speech tag of the most common uses of the word.
The response is a string which the content is a json list with strings, each one representing a pos tag.
- Raises:
OpenAIEmptyResponseError – If openai return an empty response.
LanguageCodeNotRecognizedError – If language code is not recognized.
- Parameters:
openai_key (str)
cache_path (Path | None)
word (str)
language_alpha3 (str)
- Return type:
str
- danoan.word_guru.core.api.get_reverse_definition(openai_key: str, cache_path: Path | None, text: str, language_alpha3: str) str[source]
Get a list of words that best encode the intention of a text.
The response is a string which the content is a json list with strings, each one representing a word.
- Raises:
OpenAIEmptyResponseError – If openai return an empty response.
LanguageCodeNotRecognizedError – If language code is not recognized.
- Parameters:
openai_key (str)
cache_path (Path | None)
text (str)
language_alpha3 (str)
- Return type:
str
- danoan.word_guru.core.api.get_synonym(openai_key: str, cache_path: Path | None, word: str, language_alpha3) str[source]
Get the synonyms of a word.
The response is string which content is a json list with strings, each one representing a synonym.
- Raises:
OpenAIEmptyResponseError – If openai return an empty response.
LanguageCodeNotRecognizedError – If language code is not recognized.
- Parameters:
openai_key (str)
cache_path (Path | None)
word (str)
- Return type:
str
- danoan.word_guru.core.api.get_translation(openai_key: str, cache_path: Path | None, word: str, from_language_alpha3: str, to_language_alpha3: str) str[source]
Get the translation of a word or expression.
- Raises:
OpenAIEmptyResponseError – If openai return an empty response.
LanguageCodeNotRecognizedError – If language code is not recognized.
- Parameters:
openai_key (str)
cache_path (Path | None)
word (str)
from_language_alpha3 (str)
to_language_alpha3 (str)
- Return type:
str
- danoan.word_guru.core.api.get_usage_examples(openai_key: str, cache_path: Path | None, word: str, language_alpha3: str) str[source]
Get a list of sentences in which the word is used with their different meanings.
The response is a string which the content is a json list with strings, each one representing a word.
- Raises:
OpenAIEmptyResponseError – If openai return an empty response.
LanguageCodeNotRecognizedError – If language code is not recognized.
- Parameters:
openai_key (str)
cache_path (Path | None)
word (str)
language_alpha3 (str)
- Return type:
str