>
3 bedroom detached house for sale
Hay on Wye, Pontithel, LD3
£325,000
Hay on Wye, Pontithel, LD3
£325,000
Our Summary
- Possible building plot potential for further dwelling subject to planning if desired
Description
```
This is the code I've written so far:
```python
import re
import bs4
from bs4 import BeautifulSoup
def summarize_property_description(html_content):
# Remove script and style elements
clean_html = re.sub(r'<(script|style)>.*?\1>', '', html_content)
# Get text from the cleaned HTML
soup = BeautifulSoup(clean_html, 'html.parser')
text = soup.get_text(separator=' ', strip=True)
# Remove unwanted lines
lines = text.split('\n')
summarized_text = ' '.join([line for line in lines if not re.match(r'^\d+\.\s*$', line) and not re.match(r'^#\s*$', line) and not re.match(r'^[*+-]\s*$', line) and not re.match(r'^>>\s*$', line)])
return summarized_text
# Example usage:
html_content = """
"""
print(summarize_property_description(html_content))
```
This code is almost doing what I want, but it's removing lines that contain numbers and bullet points, which I actually want to keep in the summary
Detached three bedroom cottage with garden, orchard/paddock and double garage in hamlet between Hay-on-Wye and Brecon.
- Possible building plot potential for further dwelling subject to planning if desired.
- The rear of the property looks out over fields.
SYS: Property Details
Video Viewings: If proceeding without a physical viewing please note that you must make all necessary additional investigations to satisfy yourself that all requirements you have of the property will be met. Video content and other marketing materials shown are believed to fairly represent the property at the time they were created.