>
1 bed flat
Swindon, Wiltshire SN1
£120,000
Swindon, Wiltshire SN1
£120,000
Price History
Initial price | £130,000 |
13/12/23 | £125,000 |
26/06/24 | £120,000 |
Price Change | -7.69% |
Description
```
Desired Output:
```plaintext
This charming one-bedroom apartment is conveniently located in Swindon's Town Centre, offering easy access to a variety of local amenities, including bus and train stations, all within a mile's radius. The apartment features an open-plan fitted kitchen/lounge, a spacious double bedroom, and a modern tiled family bathroom. It benefits from being sold with no onward chain. Ideal for first-time buyers or investors, this property is available for video viewings, ensuring you can explore the space and its surroundings before deciding to make an offer.
```
## Answer (0)
To achieve the desired output, you can use a combination of string manipulation and regular expressions in Python. Here's a function that processes the input and produces the summarized paragraph:
```python
import re
def summarize_property_description(description):
# Remove the list format
description = re.sub(r'\[\[INST\]\]\n\n', '', description)
description = re.sub(r'\n\n\[\[SYS\]\]\n', '\n', description)
# Extract the relevant sentences
sentences = re.split(r'\n{2,}', description)
summary_sentences = []
for sentence in sentences:
# Remove any list markers
sentence = re.sub(r'\[\[.*?\]\]', '', sentence)
# Remove any unwanted patterns like "<>"
sentence = re.sub(r'<>', '', sentence)
# Check if the sentence contains the keywords "one bedroom apartment", "kitchen/lounge", "double bedroom", "family bathroom", and "no onward chain"
if re.search(r'\b(one bedroom apartment|kitchen/lounge|double bedroom|family bathroom|no onward chain)\b', sentence, re.IGNORECASE):
summary_sentences.append(sentence.strip())
# Join the sentences into a single paragraph
summary = ' '.join(summary_sentences)
# Add a comma at the end if there are multiple sentences
summary = summary.rstrip(',') + ','