Skip to content

botcity.plugins.cloudvision.BotCloudVisionPlugin

__init__()

Bot CloudVision Plugin.

credentials(credentials)

Google Cloud Vision JSON credential file path.

Parameters:

Name Type Description Default
credentials str

Path to the JSON file.

required

entries()

Get the list of entries after reading the file.

Each element contains a list of values in which are: text, x1, y1, x2, y2, x3, y3, x4, y4 and page.

Returns:

Type Description
List[List]

List[List]: List of entries.

full_text()

Get the full text from the image.

Returns:

Name Type Description
str str

The full text.

read(filepath, raise_on_error=False)

Read the file and set the entries list.

Parameters:

Name Type Description Default
filepath str

The file path for the image or PDF to be read.

required
raise_on_error bool

Whether or not to raise an exception if it fails.

False

Raises:

Type Description
ValueError

If file is not an image or PDF.

render_rate()

Render resolution rate.

Returns:

Name Type Description
int int

resolution rate

reset_case()

Reset the configuration for upper/lower case.

set_render_rate(rate)

Set the render resolution rate.

Parameters:

Name Type Description Default
rate int

resolution rate

required

set_threshold(threshold)

Set the threshold level to be applied to the image before parsing.

Parameters:

Name Type Description Default
threshold int

Threshold value. Use None for no threshold.

required

threshold()

Threshold to be applied before parsing the image.

Returns:

Name Type Description
int int

Threshold value. By default it is None which means no threshold.

to_lower_case()

Convert the text to lower case when processing the file.

to_upper_case()

Convert the text to upper case when processing the file.