Parse_data_from_file only finding 18 sentences

Good evening,

Currently experiencing a few issues and appreciate any advice!

  1. My parse_data_from_file function uses a for loop, which, on testing, only finds 18 sentences in the original dataset. It then fails with a,

‘list’ object has no attribute ‘split’

error on the ‘print(f"First sentence has {len(sentences[0]…’ line. Slightly confused here!

  1. Slightly separate issue (and unrelated to the above, as I have currently removed this line). When I include my remove_stopwords function, I receive a

‘list’ object has no attribute ‘lower’

error. I included the ‘sentence = sentence.lower()’ argument in my ‘remove_stopwords’ function, as without it, the function would not remove the word ‘I’.

Notebook available for those brave enough to have a look!

Fixed it! I was using ‘filename’ rather than ‘csvfile’ in the csv.reader portion.

I’d also mixed up the remove_stopwords function and had some elements accidentally sat outside the function when I was moving lines of code around. D’oh!

What would be the input in the delimiter function?

There is no delimiter function. When using csv.reader, the delimiter should be set to the character on which the fields are split.