classify_rectangles module

class classify_rectangles.Classifier(r_file, n_file, page, error)[source]

Classify each rectangle if it’s obituary or not based on training data.

Note:
If Classifier does not find obituary, it adds it to already generated rectangles.
check_error(necrology, rectangle)[source]

Check coordinates of rectangle error (how near it is to necrology). Return error value of all 4 nodes.

Args:
necrology (tuple): coordinates of compared necrology. rectangle (tuple): coordinates of compared rectangle.
classify(page, error)[source]

Tag all rectangles with classes based on necrologies’ coordinates.

Args:
i (int): Page number.
load_necrologies(n_file)[source]

Load necrologies’ coordinates from file.

Args:
n_file (str): Path to file with necrologies’ coordinates.
load_rectangles(r_file)[source]

Loads rectangles’ coordinates from file.

Args:
r_file (str): Path to file with rectangles’ coordinates.
modify_rectangle_file(r_file, modified)[source]

If any necrology is not found in rectangles, rectangle file is modified.

Args:
modified (bool): flag that checks if rectangle file should be modified.
classify_rectangles.parse_args()[source]

Parse command line arguments.