The Cypher replace function returns a string after replacing every occurrence of a specified substring with another string. Its syntax is replace(string, search, replace). section 7.1
Use replace when preparing text for later parsing or normalizing extracted values:
- Replace newline characters with spaces before splitting tweet text into tokens. section 7.1
- Remove commas from hashtag tokens before lowercasing them, so equivalent hashtags are treated consistently. section 7.1
- Combine replacement with split, list comprehension, and size() to turn tweet text into usable hashtag lists. section 7.1 section 7.7
Cleaning tweet text
WITH t, replace(t.text, '\n', ' ') AS cleanText WITH t, split(cleanText, ' ') AS tokens WITH t, [el IN tokens WHERE el STARTS WITH "#" | toLower(replace(el, ",", ""))] AS hashtags




