fixing floorplan detection and adding recalculation method
This commit is contained in:
parent
335adc0856
commit
4dea766a12
4 changed files with 21 additions and 4 deletions
15
crawler/9_recalculate_regex_squaremeter.py
Normal file
15
crawler/9_recalculate_regex_squaremeter.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# recalculate regex from sqm from already previously ocr'ed text
|
||||
import json
|
||||
from rec.floorplan import extract_total_sqm
|
||||
from tqdm import tqdm
|
||||
from data_access import Listing
|
||||
|
||||
for listing in tqdm(list(Listing.get_all_listings())):
|
||||
with open(listing.path_floorplan_ocr_json()) as f:
|
||||
floorplans = json.load(f)
|
||||
|
||||
for floorplan in floorplans:
|
||||
floorplan['estimated_sqm'] = extract_total_sqm(floorplan['text'])
|
||||
|
||||
with open(listing.path_floorplan_ocr_json(), 'w') as f:
|
||||
floorplans = json.dump(floorplans, f)
|
||||
Loading…
Add table
Add a link
Reference in a new issue