Requirement Extraction ====================== The extractor turns a renter message into ``RentalRequirements``. It uses known locations from the real cache so extraction does not invent unsupported places. .. autoclass:: app.alba_core.extraction.ExtractionOutput :members: .. autoclass:: app.alba_core.extraction.RequirementExtractor :members: Example ------- .. code-block:: python from app.alba_core.extraction import RequirementExtractor from app.propertyme.cache import load_property_cache properties = load_property_cache("data/propertyme_property_seed_latest.json") known_locations = { value for item in properties for value in [item.city, item.suburb, item.region] if value } extractor = RequirementExtractor(known_locations) output = extractor.extract("Auckland house, 4 bedrooms, budget 5k, move ASAP") print(output.requirements.to_dict()) print(output.notes) print(output.to_dict()["missing_required_fields"]) Continuing a conversation ------------------------- .. code-block:: python from app.alba_core.models import RentalRequirements current = RentalRequirements(city="Auckland", budget_max=5000) output = extractor.extract("make it 4 bedrooms and a house", current=current) print(output.requirements.to_dict())