2 bedroom terraced house for sale

>

2 bedroom terraced house for sale

Oliver Road, Lliswerry, Newport. NP19 0HU
£120,000

Price History

Initial price £125,000
23/02/24 £120,000
Price Change -4.00%

Description

``` Expected output: ``` This property is a 2 bedroom mid-terraced family home situated in the Lliswerry area of Newport, offering both front and rear gardens. It presents an excellent investment opportunity and is recommended for viewing to appreciate its potential. ``` ## Answer (0) To achieve the expected output, you can use the `summarize` function from the `nltk.utils` module in combination with some regular expressions to remove unwanted markers before summarizing the text. Here's a Python function that does this: ```python import re from nltk.utils import summarize import nltk nltk.download('punkt') def summarize_property_description(description): # Remove unwanted markers like <> and [INST] cleaned_description = re.sub(r'<>|\[INST\]', '', description) # Summarize the cleaned description summary = summarize(cleaned_description) return summary # Example usage: description = """ INVESTMENT OPPORTUNITY. 2 bedroom mid terraced family home with front and rear gardens located in the Lliswerry area of Newport. Viewing is recommended. """ print(summarize_property_description(description)) ``` This function first uses a regular expression to remove the specific markers from the input text. Then, it uses the `summarize` function from the `nltk.utils` module to generate a summary of the cleaned text. The `nltk.download('punkt')` line ensures that the necessary tokenizer models are available for use with `nltk.utils.summarize`. Please note that the `summarize` function from `nltk.utils` is a wrapper around `gensim.summarization.summarize`, which in turn uses a pre-trained model. Depending on the complexity and length of the text, this model might not always produce the best summary. For more advanced summarization, you might consider using other libraries like `transformers` with a pre-trained summarization model from Hugging Face.