bdc.steps.helpers package

Submodules

bdc.steps.helpers.generate_hash_leads module

class bdc.steps.helpers.generate_hash_leads.LeadHashGenerator[source]

Bases: object

BASE_PATH = '/home/runner/work/amos2023ws06-sales-lead-qualifier/amos2023ws06-sales-lead-qualifier/src/bdc/steps/helpers'
hash_check(lead_data: Series, data_fill_function: callable, step_name: str, fields_tofill: list[str], *args, **kwargs)[source]
hash_lead(lead_data)[source]

bdc.steps.helpers.offeneregister_api module

class bdc.steps.helpers.offeneregister_api.OffeneRegisterAPI[source]

Bases: object

A class that retrieves company data from various sources based on given parameters.

_find_from_Positions_by_firstName_and_lastName(last_name

str, first_name: str) -> dict: Retrieves company data from Positions table based on the last name and first name of a person.

_find_row_by_companyId(url

str, company_id: str) -> dict: Finds and retrieves the row data for a given company ID from a specified URL.

_find_from_Capital_by_companyId(company_id

str) -> dict: Retrieves company data from the Capital database using the provided company ID.

_find_from_Addresses_by_companyId(company_id

str) -> dict: Retrieves the row from the Addresses table based on the given company ID.

_find_from_Objectives_by_companyId(company_id

str) -> dict: Retrieves the row from Objectives by the given company ID.

_find_from_Names_by_companyId(company_id

str) -> dict: Retrieves company data by company ID from the offerenregister.de website.

find_companyName_by_lastName_firstName(last_name

str, first_name: str) -> str: Finds the company name by the last name and first name of a person.

find_companyCapitals_by_lastName_firstName(last_name

str, first_name: str) -> tuple: Retrieves the capital amount and currency of a company based on the last name and first name of a person.

find_companyObjective_by_lastName_firstName(last_name

str, first_name: str) -> str or None: Finds the company objective based on the last name and first name of a person.

find_companyAddress_by_lastName_firstName(last_name, first_name)[source]
find_companyCapitals_by_lastName_firstName(last_name, first_name)[source]

Retrieves the capital amount and currency of a company based on the last name and first name of a person.

Parameters:
  • last_name (str) – The last name of the person.

  • first_name (str) – The first name of the person.

Returns:

A tuple containing the capital amount and currency of the company. If the company or capital information is not found, returns (None, None).

Return type:

tuple

find_companyName_by_lastName_firstName(last_name, first_name)[source]

Finds the company name by the last name and first name of a person.

Parameters:
  • last_name (str) – The last name of the person.

  • first_name (str) – The first name of the person.

Returns:

The name of the company if found, None otherwise.

Return type:

str

find_companyObjective_by_lastName_firstName(last_name, first_name)[source]

Finds the company objective based on the last name and first name of a person.

Parameters:
  • last_name (str) – The last name of the person.

  • first_name (str) – The first name of the person.

Returns:

The company objective if found, None otherwise.

Return type:

str or None

bdc.steps.helpers.text_analyzer module

class bdc.steps.helpers.text_analyzer.TextAnalyzer(*args, **kwargs)[source]

Bases: object

A class that provides text analysis functionalities such as spell checking, correction, and error detection.

TARGET_LANG = 'en'
calculate_sentiment_analysis_score(inp_text, lang='en')[source]

Calculates the sentiment analysis of the input text.

Parameters:
  • inp_text (str) – The input text to analyze for sentiment analysis.

  • lang (str, optional) – The language of the input text. Defaults to “english”.

Returns:

The sentiment analysis of the input text, or None if an error occurs.

Return type:

float

correct_text(text, language='en')[source]

Correct the spelling of the given text using the specified language.

Parameters:
  • text (str) – The text to be corrected.

  • language (str, optional) – The language setting. Defaults to “en”.

Returns:

The corrected text.

Return type:

str

find_number_of_grammatical_errors(inp_text, language='en')[source]

Finds the number of grammatical errors in the input text.

Parameters:
  • inp_text (str) – The input text to analyze for grammatical errors.

  • language (str, optional) – The language of the input text. Defaults to “en”.

  • max_retries (int, optional) – The maximum number of retry attempts. Defaults to 3.

Returns:

The number of grammatical errors found in the input text, or None if an error occurs.

Return type:

int

find_number_of_spelling_errors(text, language='en')[source]

Find the number of spelling errors in the given text using the specified language.

Parameters:
  • text (str) – The text to be checked.

  • language (str, optional) – The language setting. Defaults to “en”.

Returns:

The number of spelling errors.

Return type:

int

find_spelling_errors(text, language='en')[source]

Find the spelling errors in the given text using the specified language.

Parameters:
  • text (str) – The text to be checked.

  • language (str, optional) – The language setting. Defaults to “en”.

Returns:

A list of spelling errors.

Return type:

list

translate(inp_text, source_lang='auto', target_lang='en')[source]

Translates the input text to the target language.

Parameters:
  • inp_text (str) – The input text to translate.

  • source_lang (str, optional) – The source language of the input text. Defaults to “auto”.

  • target_lang (str, optional) – The target language of the input text. Defaults to TARGET_LANG.

Returns:

The translated text, or None if an error occurs.

Return type:

str

Module contents

bdc.steps.helpers.get_lead_hash_generator() LeadHashGenerator[source]