liveBook · Manning

Split

As explained in Graph Algorithms for Data Science

A split function divides a string around a delimiter and returns the resulting elements as a list.

String splitting divides a string around a delimiter and returns the resulting elements as a list. In Cypher, split(string, delimiter) turns tweet text into tokens that can be filtered or transformed. section 7.1

A practical hashtag-extraction pipeline uses string splitting as one transformation step:

  • Replace newline characters with spaces to create cleaner text. section 7.1
  • Split the cleaned text on spaces, producing a list of tokens. section 7.1
  • Use list comprehension to keep tokens beginning with #, remove commas, and lowercase them. section 7.1
  • Use size() to discard tweets whose resulting hashtag list is empty. section 7.1

Extract hashtags from 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 WHERE size(hashtags) > 0 RETURN hashtags LIMIT 5 This produces lists such as ["#sql", "#code", "#datascience", "#ai", "#ml"]. section 7.1

Listing 7.4 split function syntax
split(string, delimiter)

View the compact syntax reference for split(string, delimiter). section 7.1

How Graph Algorithms for Data Science covers it

How deep it goes
Defines the function and demonstrates its place in a cleaning, filtering, normalization, and list-processing pipeline.
Examples
Uses newline-cleaned tweets split on spaces to produce normalized hashtag lists.
What it assumes
Assumes basic Cypher familiarity while teaching the function's string input, delimiter argument, and list output directly.
What you can do after
Apply via Cypher to convert delimited strings into lists for filtering, transforming, or storing extracted elements.
How it connects
Connects string splitting with Cypher, replace functions, list comprehension, size(), hashtags, and UNWIND.

Also explained in

Compare how 11 books explain split →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.