From unstructured text data to a matrix